<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            display: none;
            font-size: large;
            background-color: #ccc;
        }
    </style>
</head>

<body>
    <div>
        <div class="box"></div>
        <input type="text">
    </div>
    <script>
        var box = document.querySelector('.box');
        var input = document.querySelector('input');
        input.addEventListener('keyup', function (e) {
            box.style.display = 'block';
            box.innerHTML = input.value;
        })
        input.addEventListener('blur', function (e) {
            box.style.display = 'none';
        })
        input.addEventListener('focus', function (e) {
            if (this.value != '') {
                box.style.display = 'block';
            }

        })
    </script>
</body>

</html>